﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PhoneRater
{
    public partial class AssignPhoneForm : Form
    {
        public AssignPhoneForm()
        {
            InitializeComponent();
        }

        private void AssignPhoneForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'assignFormDataSet.EmployeesPhones' table. You can move, or remove it, as needed.
            this.employeesPhonesTableAdapter.Fill(this.assignFormDataSet.EmployeesPhones);
            // TODO: This line of code loads data into the 'assignFormDataSet.Employees' table. You can move, or remove it, as needed.
            this.employeesTableAdapter.Fill(this.assignFormDataSet.Employees);

        }

        private void _btOk_Click(object sender, EventArgs e)
        {
            assignFormDataSet.EmployeesPhones.AddEmployeesPhonesRow(
                (int) internalNumberNumericUpDown.Value,
                fromDateDateTimePicker.Value,DateTime.Parse("31/12/2099 23:59:59"),
                (AssignFormDataSet.EmployeesRow)((DataRowView) employeComboBox.SelectedItem).Row
                );
            this.Validate();
            this.tableAdapterManager.UpdateAll(this.assignFormDataSet);
            this.Close();
        }

        private void employeesBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.employeesBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.assignFormDataSet);

        }
    }
}
